Use Pixhawk in AGV

Introduction

This tutorials shows how to config Pixhawk to integrate in an AGV. It permits to get information of the device (IMU and gyroscope) througth MAVLINK protocol using the package mavros.

Device Setup

Install QGroundControl

For latest firmware versions, modemmanager has to be removed

  • >sudo apt-get remove modemmanager –> modemmanager interferes with any non-modems and should be removed.

Flash firmware

  • Start QGroundControl and go to Setup->Firmware. Then connect the Pixhawk through the USB interface and select the "PX4 Flight Stack" in the menu that will show on the right.

QGroundControl

Configure the following parameters:

  • Setup->Airframe: select Octorotor +

  • Setup->Parameters->Radio Switches->RC_MAP_MODE_SW: set to Channel 5.

  • Setup->Parameters->System->SYS_COMPANION: set to Companion Link (921600 baud, 8N1)

Sensor calibration

Using QGroundControl:

  1. Connect the device (using the USB port) and go to the sensor window.
  2. Calibrate the desired sensors (gyroscope, accelerometer and compass) with Autopilot orientation set to ROTATION_NONE, following the instructions.
  3. Go to Setup->Parameters->Sensor Calibration, and set the SENS_BOARD_ROT parameter . Check here for more details https://pixhawk.org/sensor_orientation

    • For SummitXL, normally the values are:
      • Left side -> roll 90º -> value 16

      • Right side -> roll 270º -> value 20

  4. Position the PIXHAWK on the robot and start the “Level Horizon” calibration, in order to correct the misalignments.

ROS packages configuration

  • sudo apt-get install ros-indigo-mavros-*

  • px4.launch

    <launch>
        <!-- vim: set ft=xml noet : -->
        <!-- example launch script for PX4 based FCU's -->
    
        <arg name="fcu_url" default="/dev/ttyUSB0:921600" />
        <arg name="gcs_url" default="" />
        <arg name="tgt_system" default="1" />
        <arg name="tgt_component" default="1" />
        <arg name="log_output" default="screen" />
    
        <include file="$(find mavros)/launch/node.launch">
            <arg name="pluginlists_yaml" value="$(find summit_xl_bringup)/config/px4_pluginlists.yaml" />
            <arg name="config_yaml" value="$(find mavros)/launch/px4_config.yaml" />
    
            <arg name="fcu_url" value="$(arg fcu_url)" />
            <arg name="gcs_url" value="$(arg gcs_url)" />
            <arg name="tgt_system" value="$(arg tgt_system)" />
            <arg name="tgt_component" value="$(arg tgt_component)" />
            <arg name="log_output" value="$(arg log_output)" />
        </include>
    </launch>
  • px4_pluginlists.yaml

    plugin_blacklist:
    - safety_area
    - image_pub
    - vibration
    - distance_sensor
    - vision_speed
    - vision_pose
    - px4flow
    - mocap
    - image
    - setpoint_position
    - setpoint_attitude
    - setpoint_accel
    - safety_area
    - local_position
    - 3dr_radio
    
    plugin_whitelist: []
    #- 'sys_*'

    Note: The node can crash eventually, thus it is necessary to change the option required="true" to respawn="true" in the node.launch file of the mavros package.

Troubleshooting

  1. The device is not recognized when plugged → Needs to set proper permissions to the port:

    sudo chmod 666 /dev/ttyACM0 (sets the proper permission ) sudo usermod -a -G dialout name (adds your user to the dialout-group . Replace name with your account name and do not forget to logout-login)

  2. The firmware upgrade cannot be performed in QgroundControl: sudo apt-get remove modemmanager (modemmanager tends to occupy a device only briefly, but it's initial tests make trouble for any firmware upgrade software that reboots the pixhawk)

  3. The device shows drift. Note that the device is sensitive to temperature changes and proximity to magnetic fields or metal parts.

    • -If the temperature close to the device changes dramatically, the gyros will show a considerably drift that will be integrated in the robot orientation with independence of the used filter.
    • -If the device is mounted close to magnetic fields or metal parts, the magnetometers won't measure correctly.
    Note that temperature stability is more important, as magnetometers are not used in the default configuration and won't be used by most of the customers.

Wiki: RobotnikAutomation/Tutorials/Use Pixhawk in AGV (last edited 2016-07-23 14:47:10 by JoseRapado)